﻿<?php

include './php-ofc-library/open-flash-chart.php';

		$link= mysql_connect("localhost","root","")or die ('Error connecting to mysql');
		$sdb=mysql_select_db("asodeco");
		$query="SELECT factor.enunciado AS fact FROM factor WHERE factor.id= '".$_GET["tit"]."';";
		$result=mysql_query($query ,$link);
		$row=mysql_fetch_array($result);
		$tit=$row['fact'];
		
$max= max((int)$_GET["pos"],(int)$_GET["neg"],(int)$_GET["mneg"]);
$title = new title( $tit );

$bar = new bar();
$bar->set_values( array((int)$_GET["pos"],(int)$_GET["neg"],(int)$_GET["mneg"]) );

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $bar );

//
// create a Y Axis object
//
$y = new y_axis();
// grid steps:
$y->set_range( 0, round($max+(0.2*$max)), round($max*0.1));

//
// Add the Y Axis object to the chart:
//
$chart->set_y_axis( $y );


//crea el arreglo de los labels
$labels=array('Positivo','Negativo', 'Muy Negativo');

$x_labels = new x_axis_labels();
$x_labels->set_steps( 1 );
$x_labels->set_colour( '#A2ACBA' );
$x_labels->set_labels( $labels );

$x = new x_axis();
$x->set_colour( '#A2ACBA' );
$x->set_grid_colour( '#D7E4A3' );
// Add the X Axis Labels to the X Axis
$x->set_labels( $x_labels );

$x_legend = new x_legend( 'Asodeco C.A.' );
$x_legend->set_style( '{font-size: 12px; color: #0066FF; align:right}' );
$chart->set_x_legend( $x_legend );

$chart->set_x_axis( $x );
                    
echo $chart->toString();


?>